import request from '@/utils/request';

type pwdType = {
  id: number;
  oldPassword: string;
  newPassword: string;
};
export const postMemberUpdatePwd = (data: pwdType) =>
  request({ url: '/admin/member/updatePwd', method: 'post', data });

// 注册发卡器
export const RegisterIssuer = () =>
  request({ url: '/admin/sys/register/card/issuer', method: 'post', });

export const GetT1_T8 = (url: string) =>
  request({ url, method: 'post', });

export const uselogout = () =>
  request({ url: "/admin/site/logout", method: 'post', });

export const getdownload = () =>
  request({ url: '/admin/driver/download', });

export const downloadFile = async (downurl: string,name:string) => {
  const response = await fetch(downurl);
  const blob = await response.blob();
  const url = window.URL.createObjectURL(blob);
  const a = document.createElement('a');
  a.href = url;
  a.download = name;
  document.body.appendChild(a);
  a.click();
  window.URL.revokeObjectURL(url);
};
